﻿package mortal.game.view.copy.crossMainCity.mainCityPosition
{
    import Message.Game.*;
    import Message.Public.*;
    import com.mui.controls.*;
    import com.mui.core.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.game.manager.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.copy.crossMainCity.*;

    public class MainCityPosSmallIcon extends HintBaseIcon
    {
        private var _info:SMainCityPositonOper;
        private static var _instance:MainCityPosSmallIcon;

        public function MainCityPosSmallIcon()
        {
            super("");
            this.layer = LayerManager.smallIconLayer;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._info = null;
            super.disposeImpl(param1);
            return;
        }// end function

        override protected function clickHandler(event:MouseEvent) : void
        {
            var _loc_2:String = null;
            if (this._info)
            {
                if (this._info.newPositon == EMainCityPosition._EMainCityNoMember)
                {
                    _loc_2 = Language.getStringByParam(21410, MainCityCache.getPosNameByPosType(this._info.oldPositon));
                }
                else
                {
                    _loc_2 = Language.getStringByParam(21411, MainCityCache.getPosNameByPosType(this._info.newPositon));
                }
                Alert.mode = Alert.Mode_NoneNotModal;
                Alert.show(_loc_2, null, Alert.OK | Alert.CANCEL, null, null, null, 4);
            }
            this.hide();
            return;
        }// end function

        public function set data(param1:SMainCityPositonOper) : void
        {
            var _loc_2:String = null;
            this._info = param1;
            if (this._info.newPositon == EMainCityPosition._EMainCityNoMember)
            {
                _loc_2 = ImagesConst.MainCityRemovePos;
            }
            else
            {
                _loc_2 = ImagesConst.guild_renIcon;
            }
            _icon.bitmapData = GlobalClass.getBitmapData(_loc_2);
            return;
        }// end function

        public static function get instance() : MainCityPosSmallIcon
        {
            if (!_instance)
            {
                _instance = new MainCityPosSmallIcon;
            }
            return _instance;
        }// end function

        public static function get isViewShow() : Boolean
        {
            return _instance && !_instance.isHide;
        }// end function

    }
}
